package com.huang.controller;

import com.huang.enums.ResultStatus;
import com.huang.vo.ResultObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;

@RequestMapping("/upload")
@RestController
public class UploadFileController {

    @ApiOperation("上传excel")
    @PostMapping("/excelTest")
    public ResultObject excelTest(MultipartFile file) throws IOException {
        try (InputStream is = file.getInputStream()) {

            int read = is.read();
            System.out.println(read);
            return null;
        } catch (IOException e) {
            return ResultObject.fail(ResultStatus.SYS_NEED_RETRY);
        }
    }





//    @ApiOperation("11")
//    @PostMapping("/uploadSources")
//    public ResultObject<Boolean> uploadSources(MultipartFile file) {
//        try (InputStream is = file.getInputStream()) {
//            System.out.println(is.read());
//        } catch (IOException e) {
//
//            return ResultObject.fail(ResultStatus.SYS_NEED_RETRY);
//        }
//        return ResultObject.success(true);
//    }
}
